Factors associated with the use of emergency departments